home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / array / stringcatchar.c < prev    next >
C/C++ Source or Header  |  2001-05-12  |  530b  |  34 lines

  1.  
  2. #include "tek/array.h"
  3.  
  4. /* 
  5. **    TEKlib
  6. **    (C) 2001 TEK neoscientists
  7. **    all rights reserved.
  8. **
  9. **    TBOOL TStringCatChar(TSTRPTR *s1, TCHAR c)
  10. **
  11. **    append single character to a dynamic string.
  12. **
  13. */
  14.  
  15. TBOOL TStringCatChar(TSTRPTR *s1, TBYTE c)
  16. {
  17.     if (*s1 && c != 0)
  18.     {
  19.         TARRAY *a1 = *((TARRAY **) s1) - 1;
  20.         if (a1->valid)
  21.         {
  22.             TUINT oldlen = a1->len - 1;
  23.             if (TArraySetLen((TAPTR *) s1, oldlen + 2))
  24.             {
  25.                 *(*s1 + oldlen) = c;
  26.                 *(*s1 + oldlen + 1) = 0;
  27.                 return TTRUE;
  28.             }
  29.             return TFALSE;
  30.         }
  31.     }
  32.     return TFALSE;
  33. }
  34.